﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Administrator/Master/Administrator.Master" AutoEventWireup="true" CodeBehind="CKEditor.aspx.cs" Inherits="Axis.Web.Administrator.Views.Project.CKEditor" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="AdministratorTitle" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="AdministratorHead" runat="server">
    <script>
        $(function () {
            var newEditor;
            $("#btnShow").click(function () {

                var dialog = new CDialog({
                    title: "Edit User",
                    width: 1000,
                    create: function () {

                    },
                    open: function () {
                        var config = CKEDITOR.instances["ctl00_AdministratorBody_CKEditor1"].config;
                        console.log("config", config);
                        newEditor = CKEDITOR.replace("ckeditorDemo", config);
                        //newEditor = CKEDITOR.appendTo("ckeditorDemo");
                        // CKEDITOR.instances["ctl00_AdministratorBody_CKEditor1"].destroy();
                    },
                    close: function () {

                    },
                    buttons: [
                        {
                            text: "Update",
                            click: function () {
                                var value = CKEDITOR.instances["ckeditorDemo"].getData();
                                console.log("CKEDITOR:::", value, CKEDITOR, newEditor);
                            }
                        }
                    ]
                });
                dialog.Init("#Dialog-CKEditor");
            });
            console.log("CKEDITOR", CKEDITOR);
        });
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="AdministratorBody" runat="server">
    <button type="button" id="btnShow">Show</button>
    <div id="Dialog-CKEditor">
        <label>Editor</label>
        <textarea id="ckeditorDemo"></textarea>
    </div>
    <div style="display: block;">
        <CKEditor:CKEditorControl ID="CKEditor1" CssClass="CKEDITOR" runat="server"></CKEditor:CKEditorControl>
    </div>
</asp:Content>
